package com.qiyang.entity;

import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * Created on 2020/12/11.
 *
 * @author qiyang.
 * 描述：
 */
public class UserVo {

    @NotNull
    private Integer id;

    @Length(max = 12, min = 4, message = "用户名必须为{min}~{max}位")
    private String userName;

    /**
     * 注意：此处会覆盖自定义类型转换器哦
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date birthday;

    /**
     * 格式化演示 ￥10,000.00
     */
    @NumberFormat(style = NumberFormat.Style.CURRENCY)
    // @NumberFormat(pattern = "#,###.##")
    private Double balance;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public Double getBalance() {
        return balance;
    }

    public void setBalance(Double balance) {
        this.balance = balance;
    }

    @Override
    public String toString() {
        return "UserVo{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", birthday=" + birthday +
                ", balance=" + balance +
                '}';
    }
}
